package WindFarm;

import java.applet.Applet;
import java.awt.Graphics;

public class WindFarm extends Applet implements Runnable{
    
    int angle=0;
    public void init() {
        resize(400,500);
        new Thread(this).start();
    }
    public void run() {
        while(true)
        {
            repaint();
            angle+=1;
            try{Thread.sleep(10);}
            catch(Exception e){}                   
        }
    }
    
    public void paint(Graphics g){
        drawPole(g);
        g.drawOval(100,100,200,200);
        g.drawLine(getX(angle), getY(angle),getX(angle+180), getY(angle+180));
        g.drawLine(getX(angle+90), getY(angle+90),getX(angle+270), getY(angle+270));

        
    }
    public void drawPole(Graphics g){
        g.drawLine(198, 200, 202, 200);
        g.drawLine(198, 200, 198, 500);
        g.drawLine(202, 200, 202, 500);
        g.drawLine(198, 499, 202, 499);        
    }
    
    public int getX(int ang){
        return (int)(200+(float) (100 * Math.cos(Math.toRadians(ang))));}
    
    
    public int getY(int ang){
            return (int)(200+(float) (100 * Math.sin(Math.toRadians(ang))));}
}